<?php

namespace app\store\controller\apps\bargain;

use app\store\controller\Controller;
use think\Cache;
use think\Request;
use think\Db;
/**
 * 广告统计
 * Class Ad
 * @package app\store\controller\apps\bargain
 */
class Ad extends Controller
{
    /**
     * 砍价活动列表
     * @param string $search
     * @return mixed
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function index()
    {
    	$params = \request()->request();
    	$time   = (isset($params['date']) && !empty($params['date'])) ? $params['date'] : time();
    	// 当天0点时间戳和23:59:59的时间戳
		$year	= date("Y",$time);
		$month	= date("m",$time);
		$day	= date("d",$time);
		$start	= mktime(0,0,0,$month,$day,$year);//当天开始时间戳
		$end	= mktime(23,59,59,$month,$day,$year);//当天结束时间戳
 
        // 今天的
        $list = db('ads_jump')->where('date','between time',[$start,$end])->paginate(15, false, [
                'query' => \request()->request()
            ]);
        // print_r($list);
        // $all  = db('ads_jump')->field("FROM_UNIXTIME(date,'%Y-%m-%d') as time,id,user_id,jump_ads_appid,jump_ads_name,total,number,date")->group('time')->select();
        return $this->fetch('index', compact('list'));
    }
}
?>